package com.neuedu.his.framework;

/**
 * 项目：      his
 * 类名:       CommonResult
 * 创建时间：  2020/12/22  13:36
 * 描述 :
 * 作者 :     张金山
 * QQ :     314649444
 * Site:      https://jshand.gitee.io
 */
public class CommonResult {

    private Integer code;
    private String msg;
    private Object data;


    private CommonResult(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    /**
     * 成功的反馈
     * @param data
     * @return
     */
    public static CommonResult success(Object data){
        return new CommonResult(200,"",data);
    }

    /**
     * 未找到处理方法
     * @param msg
     * @return
     */
    public static CommonResult noHanlder(String msg){
        return new CommonResult(404,msg,null);
    }


    public static CommonResult noHanlder(){
        return noHanlder("未找到处理方法");
    }

    /**
     * 内部报错了
     * @param msg
     * @return
     */
    public static CommonResult error(String msg){
        return new CommonResult(500,msg,null);
    }

    public static CommonResult nopromiss(String msg){
        return new CommonResult(403,msg,null);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
